/*
 * 删除物料大类交易
 * 参数   交易码：trancode=12114
 * 
 */

package org.ccams.tran;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;
/**
 * 删除物料大类交易
 * @author liuguangshuai@gmail.com
 * 系统名称：定制化辅助生产制造系统
 * 时间：Oct 16, 2008
 */
public class Tran12114 extends AbstractJsonTran {

	@SuppressWarnings("unchecked")
	public void buildJSONObject(Map model, JSONObject json,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String id = (String) request.getParameter("id");
		id = (id != null) ? id : "";
		HashMap<String, Object> jsonMap = new HashMap<String, Object>();
		boolean success = false;
		String message = "";
		int i =0;
		//支持批量删除
		String[] aId = id.split(",");
		for(int k=0;k<aId.length;k++){
			i = getCcamsService().getTgoodsclassDao().deleteByPrimaryKey(Integer.parseInt(aId[k]));
		}
		if (i == 1) {
			success = true;
			message = "大类删除成功";
		} else {
			success = false;
			message = "大类删除失败";
		}
		jsonMap.put("success", success);
		jsonMap.put("message", message);
		json.putAll(jsonMap);
	}
}
